package factory.simplefactory;

import Utils.XmlUtils;

public class Client {
    public static void main(String[] args) {
        try
        {
            //图形
            Graphical graphical;
            String brandName= XmlUtils.getBrandName("SimpleFactoryConfigGraphical.xml");
            //获取工厂
            GraphicalFactory graphicalFactory=GraphicalFactory.getGraphicalFactory();
            graphical=graphicalFactory.getGraphical(brandName);
            //判断从工厂拿回来的图形
            if (graphical == null) {
                System.out.println("什么都没拿到");
            }else {
                System.out.println("我从工厂拿出了："+graphical.name);
                graphical.draw();
                graphical.erase();
            }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
    }
}
